package com.darker.yygh.controller;

import com.atguigu.yygh.model.hosp.Schedule;
import com.darker.yygh.result.Result;
import com.darker.yygh.service.ScheduleService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/hosp/schedule")
//@CrossOrigin
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;
    //根据医院编号和科室编号，查询排班规则数据
    @ApiOperation("查看排班规则")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depecode}")
    public Result getScheduleRule(@PathVariable long page, @PathVariable long limit,
                                  @PathVariable String hoscode, @PathVariable String depecode){
        Map<String,Object> scheduleRule=scheduleService.getScheduleRule(page,limit,hoscode,depecode);
        return Result.ok(scheduleRule);
    }
    @ApiOperation("查询排班详细信息")
    //根据医院编号 科室编号 工作日期查询排班详细信息
    @GetMapping("getScheduleDetail/{hoscode}/{depecode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode, @PathVariable String depecode,@PathVariable String workDate) {
       List<Schedule> scheduleList= scheduleService.getScheduleDetail(hoscode,depecode,workDate);
        return Result.ok(scheduleList);
    }

}
